import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home/index.vue'
import Login from '../views/Login/index.vue'

import Game from '../views/Home/components/Game/Game.vue'
import Music  from '../views/Home/components/Music/Music.vue'
import New from '../views/Home/components/News/New.vue'

Vue.use(VueRouter);
export default new VueRouter({
    // mode: "history",
    //使用routes配置项配置路由表
    routes:[
        {
            path:"/home",
            component:Home,
            //设置路由模式为history模式!!!!

             //默认子路由配置方式2
            // redirect:"/home/New",
             //如果当前的路由设置有默认子路由,则不建议书写name命名路由
            children:[
                //二级路由及多级路由的path两种写法:1.完整的路径  2.只写当前二级路由的字符串地址,不带/
               {
                path:"Game",
                component:Game,
                name:"Game"
               },
               {
                path:"Music",
                component:Music,
                name:"Music"

               },
               {
                path:"New",
                component:New,
                name:"New"
               },
               //默认子路由配置方式1
               {
                path:"/",
                redirect:"/home/New"

               }
           
            ]
        },
        {
            path:"/Login",
            component:Login
        },
        //匹配默认路由
        {
            path:"/",
            redirect:"/home"
        }
        
    ]
})